package AccessDB;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class ConnectionDB {

	private String url = "jdbc:jtds:sqlserver://localhost:1433/Sigae";
	private String username = "sa";
	private String password = "senha";
	
	private Connection con = null;
	private static ConnectionDB connection = null;
	
	private ConnectionDB()
	{
		try {
			Class.forName("net.sourceforge.jtds.jdbc.Driver");
			con = DriverManager.getConnection(url,username,password);
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	public synchronized static ConnectionDB getInstance()
	{
		if(connection == null)
			connection = new ConnectionDB();
		return connection;
	}
	
	public Connection getConnection()
	{
		return con;
	}
}
